package com.iamdigger.server.job;

import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Main interface
 * Created by caiweiming on 2016/4/25.
 */
public class JobMain {

    private ClassPathXmlApplicationContext context;

    private static volatile boolean running = true;


    private void loadConfigFile() {
        context = new ClassPathXmlApplicationContext("classpath*:spring/*.xml");
    }

    private void startContext() {
        if(null == context) {
            loadConfigFile();
        }
        context.start();
    }

    public static void main(String[] args) {
        JobMain jm = new JobMain();
        jm.startContext();


        synchronized (JobMain.class) {
            while (running) {
                try {
                    JobMain.class.wait();
                } catch (Throwable ignore) {}
            }
        }
    }
}
